package com.ideaaedi.springcloud.jd.commonspring.mybatisplus;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.context.ApplicationContext;

import javax.annotation.Resource;

/**
 * 扩展{@link ServiceImpl}
 *
 * @author <font size = "20" color = "#3CAA3C"><a href="https://gitee.com/JustryDeng">JustryDeng</a></font> <img
 * src="https://gitee.com/JustryDeng/shared-files/raw/master/JustryDeng/avatar.jpg" />
 * @since 2021.0.5.B
 */
public class ServiceImplExt<M extends BaseMapper<T>, T> extends ServiceImpl<M, T> {
    
    @Resource
    protected ApplicationContext applicationContext;
    
    @Override
    public boolean update(Wrapper<T> updateWrapper) {
        TableInfo tableInfo = TableInfoHelper.getTableInfo(entityClass);
        return this.update(tableInfo.newInstance(), updateWrapper);
    }
    
}